#include "CG_parser.h"


int main_test()
{
	PARSE_RESULT p_res;
	CG_str_hash my_hash;
	CG_ff_grid my_grid(3);
	CG_flip_flop *ff;
	CG_flip_flop *ff_prev;
	CG_toggle_vector vXor, vAnd, vOr;
	CG_parser *my_parser = new CG_parser("fixed_FF_location.rpt", "activity_VTP.rpt", "fixed_ff_list_VTP.rpt");

	p_res = my_parser->parse_data(my_hash, my_grid);
	std::clog << "The result of parsing is " << p_res << endl;

	ff = my_grid.CG_ff_grid_get_element_by_id(58);
	if(NULL != ff)
	{
		clog << "ff number 58 is " << ff->get_name() << endl;
		clog << "ff activity is:" << endl;
		for(long i = 0; i < ff->get_vector_length(); i++)
		{
			clog << "	time[" << i << "] is " << (*ff)[i] << endl;
		}
	}

	ff_prev = my_grid.CG_ff_grid_get_next(ff);
	if(NULL != ff_prev)
	{
		clog << "ff number 57 is " << ff_prev->get_name() << endl;
		clog << "ff activity is:" << endl;
		for(long i = 0; i < ff_prev->get_vector_length(); i++)
		{
			clog << "	time[" << i << "] is " << (*ff_prev)[i] << endl;
		}
	}

	vAnd = (*ff_prev)&(*ff);
	vOr = (*ff_prev)|(*ff);
	vXor = (*ff_prev)^(*ff);

	for(long j = 0; j < 94; j++)
	{
		clog << "	XOR: time[" << j << "] is " << vXor[j] << " = " << (*ff_prev)[j] << " ^ " << (*ff)[j] << endl;
		clog << "	AND: time[" << j << "] is " << vAnd[j] << " = " << (*ff_prev)[j] << " & " << (*ff)[j] << endl;
		clog << "	OR: time[" << j << "] is " << vOr[j] << " = " << (*ff_prev)[j] << " | " << (*ff)[j] << endl;
	}

 	return 0;
}